<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>用户密码修改</title>
<meta http-equiv="expires" content="0">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<link rel="stylesheet" href="../css/admin_style.css" />
<script type="text/javascript" src="../js/core/core.js"></script>
<script type="text/javascript" src="../js/pagination.js"></script>
<script type="text/javascript" src="../js/validate.js"></script>
<script type="text/javascript">
document.onkeydown = function(e){
	var e = is_ie ? window.event: e;
	if ( e.keyCode==116) {
		window.location.reload();
		if (is_ie) {
			e.keyCode = 0;
       		e.cancelBubble = true;
		}
		return false;
	}
}

function openNewUrl(id,name,url){
	parent.PW.Dialog({
		'id': id,
		'name': name,
		'url': url
	}).loadIframe(url);
}
</script>

<script type="text/javascript">
onReady(function(){
	if(parent.adminNavClass){
		parent.adminNavClass.initTips();
	}
})
</script>
</head>
<body>
<div class="wrap">
<div class="admin_info mb10">
	<h3 class="h1"><b>提示信息</b></h3>
	<div class="legend">主要功能:用户自身密码修改</div>
</div>
<form action="user/userChangePassword" method="post"  onsubmit="return submitForm(this);">
<h2 class="h1"><b>密码修改</b></h2>
<div class="admin_table mb10">
<table>
<tbody>
<tr class="tr2 vt">
    <td class="td1">现登录密码：</td>
    <td class="td2"><input class="input input_wa" name="oldPassword" type="password" id="oldPassword" value="" size="40" validate="现登录密码||notnull">
        <font color="red">*</font>
    </td>
</tr>
<tr class="tr2 vt">
    <td class="td1">新登录密码：</td>
    <td class="td2"><input class="input input_wa" name="newPassword" type="password" id="newPassword" value="" size="40" validate="新登录密码||notnull">
        <font color="red">*</font>
    </td>
</tr>
</table>
</div>
<div class="tac mb10">
	<span class="btn"><span><button type="submit">提交</button></span></span>
	<span class="btn"><span><button type="button" onclick="history.go(-1);">返 回</button></span></span>
</div>
</form>
<div class="c"></div>
</div>

<script type="text/javascript" src="../js/global.js"></script>
<script type="text/javascript" src="../js/pw_ajax.js"></script>
<script type="text/javascript" src="../js/admin.js"></script>
<script type="text/javascript" src="../js/date.js"></script>
<script type="text/javascript" src="../js/plugin.js"></script>
<script type="text/javascript">
function submitForm(form){
      if(!frmSubmit(form))return false;
      var oldPassword=document.getElementById("oldPassword").value;
      var newPassword=document.getElementById("newPassword").value;
      if(!newPassword || newPassword.length<6){
          alert("新密码长度过短，重新输入");
          return false;
      }
      if(oldPassword==newPassword.length){
          alert("输入的新旧密码一样，无须更改密码！");
          return false;
      }
      alert("若更改成功，新密码生效为："+newPassword+"，请牢记新密码！");
      return true;
    }
function showConfirm(info,href){
 info = info ;//+ "<br>操作理由：<input type='text' id='____operationReason'><br>操作密匙：<input type='text' id='____operationPassword'>";
 showDialog({type:"confirm",message:info,onOk:function(){
   //var ____operationReason=document.getElementById("____operationReason").value;
   //if(!____operationReason || ____operationReason==""){alert("请输入操作理由");return false;}
   location.href=href;
   //openNewUrl('user'+new Date().getTime(),info,href);
   return true;
 }});
}
var operations=document.getElementsByTagName("a");
for(var i=0;i<operations.length;i++){
    var obj=operations[i];
    var confirm=obj.getAttribute("confirm");
    if(!confirm || confirm!="yes")continue;
    obj.attachEvent("onclick",function(e){
        e=window.event||e;
        var el=e.srcElement;
        //test();
        if(el.href.indexOf("javascript:void")==-1)
        el.href="javascript:void(0);showConfirm('"+"确认执行"+el.innerText+"操作？！"+"','"+el.href+"');"
        return false;
    })
}

var allInputs = document.getElementsByTagName('input');
if(allInputs && allInputs.length>0){
	for(var i=0; i<allInputs.length;i++)
	{
		var ipt = allInputs[i].parentNode;
		if(ipt.tagName=='LI'&& allInputs[i].type=='radio')
		{
			allInputs[i].checked && (ipt.className='current');
			ipt.onclick = function(){radioWithWords(this)};
		}
	}
}
</script>
<script type="text/javascript">
    if (typeof (HTMLElement) != "undefined" && !window.opera) {
    HTMLElement.prototype.__defineGetter__("outerHTML", function () {
        var a = this.attributes, str = "<" + this.tagName, i = 0; for (; i < a.length; i++)
            if (a[i].specified)
                str += " " + a[i].name + '="' + a[i].value + '"';
        if (!this.canHaveChildren)
            return str + " />";
        return str + ">" + this.innerHTML + "</" + this.tagName + ">";
    });
    HTMLElement.prototype.__defineSetter__("outerHTML", function (s) {
        var r = this.ownerDocument.createRange();
        r.setStartBefore(this);
        var df = r.createContextualFragment(s);
        this.parentNode.replaceChild(df, this);
        return s;
    });
    HTMLElement.prototype.__defineGetter__("canHaveChildren", function () {
        return !/^(area|base|basefont|col|frame|hr|img|br|input|isindex|link|meta|param)$/.test(this.tagName.toLowerCase());
    });
}
if (typeof (HTMLElement) != "undefined" && !window.opera) {
    HTMLElement.prototype.__defineGetter__("outerHTML", function () {
        var a = this.attributes, str = "<" + this.tagName, i = 0; for (; i < a.length; i++)
            if (a[i].specified)
                str += " " + a[i].name + '="' + a[i].value + '"';
        if (!this.canHaveChildren)
            return str + " />";
        return str + ">" + this.innerHTML + "</" + this.tagName + ">";
    });
    HTMLElement.prototype.__defineSetter__("outerHTML", function (s) {
        var r = this.ownerDocument.createRange();
        r.setStartBefore(this);
        var df = r.createContextualFragment(s);
        this.parentNode.replaceChild(df, this);
        return s;
    });
    HTMLElement.prototype.__defineGetter__("canHaveChildren", function () {
        return !/^(area|base|basefont|col|frame|hr|img|br|input|isindex|link|meta|param)$/.test(this.tagName.toLowerCase());
    });
}
</script>
<script type="text/javascript">
function getQueryString(form,param) {
        var datastring = '';
        var inputs = form.getElementsByTagName('INPUT');
        for (var i = 0; i < inputs.length; i++) {
            if(inputs[i].name==param)continue;
            
            switch (inputs[i].getAttribute('type')) {
                case 'text':
                    datastring = plamostr(inputs[i], datastring);
                    break;
                case 'hidden':
                    datastring = plamostr(inputs[i], datastring);
                    break;
                case 'checkbox':
                    if (inputs[i].checked) {
                        datastring = plamostr(inputs[i], datastring);
                    }
                    break;
                case 'radio':
                    if (inputs[i].checked) {

                        datastring = plamostr(inputs[i], datastring);
                    }
                    break;
            }
        }
        var textareas = form.getElementsByTagName('TEXTAREA');
        for (var i = 0; i < textareas.length; i++) {
            datastring = plamostr(textareas[i], datastring);
        }
        var selectes = form.getElementsByTagName('SELECT');
        for (var i = 0; i < selectes.length; i++) {
            datastring = plamostr(selectes[i], datastring);
        }
        if(param){
            document.getElementById(param).value=datastring;
        }
        return datastring;
    }
    function plamostr(object, datastring) {
        /**
         *拼装Form数据字符串
         */
        if (datastring.length > 0) {
            datastring += '&' + object.getAttribute('name') + '=' + object.value;
        } else {
            datastring += object.getAttribute('name') + '=' + object.value;
        }
        return datastring;
    }
</script></body></html>
